import request from '@/utils/request'

// 根据登录用户获取其对应的菜单栏权限
export const getMenuListApi = () => request('/menus', 'get')
// 获取用户列表数据
export const getUserListApi = (params) => request('/users', 'get', params)

// 修改用户状态
export const changeUserStateApi = (uid, type) => request(`/users/${uid}/state/${type}`, 'put')
// 删除用户
export const deleteUserByIdApi = (id) => request(`/users/${id}`, 'delete')

// 新增用户
export const addUserApi = (formData) => request('/users', 'post', formData)
// 修改用户
export const editUserApi = (formData) => request(`/users/${formData.id}`, 'put', formData)

// 给用户分配角色
export const setRoleApi = (uid, rid) => request(`/users/${uid}/role`, 'put', { rid })